//
//  WebExtractorController.h
//  WebClipper
//
//  Created by Daniel Braun on 05/02/08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@class WCWebLoader;
@class WCExtractSetArray;

@interface WebExtractorController : NSObject {
	WCWebLoader *loader;
	NSMutableDictionary *extracted;
	NSArray *_aextracted;
	WCExtractSetArray *esets;
	id delegate;

}

/* step 1 : load an .webExtract file, probably from application resources */
- (BOOL) loadFile:(NSString *)name fromBundleResources:(BOOL)fr;

/* step 2 : possibly - for complex case - change pages url or user input values */
- (NSURL *) urlForPage:(NSString *)page;
- (void) setUrl:(NSURL *)url forPage:(NSString *)page;

- (NSDictionary *) userInputsInPage:(NSString *)page;
- (void) setUserInput:(NSString *)varname inPage:(NSString *)page toValue:(NSString *)value;

/* step 3 : fetch pages */
- (void) fetchDataWithDelegate:(id)aDelegate;

/* step 4: get values */
- (NSDictionary *) extractedDictionary;
- (NSArray *) extractedArray;
- (NSString *)html;
- (NSData *)dhtml;

- (void) didEndLoad;
- (BOOL) willStartLoad;

@end

@interface NSObject (WebExtractorControllerDelegateMethod)
// informal protocols of methods your delegate may implement
- (void) dataFetched;
- (void) allDataFetched;
- (void) dataFetchError;
@end
